package com.lyx.bank.controller;



import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyx.bank.entity.TransactionRecord;
import com.lyx.bank.response.Result;
import com.lyx.bank.service.RecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;




/**
 * @ClassName RecordsFeignController
 * @Description: TODO
 * @Author 86152
 * @Date 2022/4/24
 * @Version V1.0
 **/
@RestController
public class RecordsFeignController {

    @Autowired
    RecordsService recordsService;

    @GetMapping("/records")
    public Result getRecordsList(
            @RequestParam(value = "current",required = true,defaultValue = "1") Integer current,
            @RequestParam(value = "size",required = true,defaultValue = "2") Integer size,
            @RequestParam(value = "cardNo") String cardNo,
            @RequestParam(value = "oneDate",required = false) String oneDate,
            @RequestParam(value = "towDate",required = false)  String towDate
    ){
        Page<TransactionRecord> page = new Page<>(current, size);
        Page<TransactionRecord> record = recordsService.getRecord(page,cardNo, oneDate, towDate);
        return Result.ok().data("record",record);
    }
}
